import request from '@/utils/request';

const appUrl = '/scrm-api/console/app';

// 获取应用列表
export const getAppList = async () => {
    return await request.get(`${appUrl}/list`);
};

// 获取我的应用
export const getMyAppList = async () => {
    return await request.get(`${appUrl}/corp-app/list`);
};
// 获取第三方应用
export const getThirdAppList = async () => {
    return await request.get(`${appUrl}/third-app-list`);
};
// 企业添加应用
export const addEnterpriseApp = async (data: any) => {
    return await request.post(`${appUrl}/add-corp-app`, data);
};

// 添加企业
export const addEnterprise = async (data: any) => {
    return await request.post('/scrm-api/console/tenant/corp/add', data);
};

// 安装授权链接URL
export const getLink = async (params: object) => {
    return await request.get('/scrm-api/console/install/get-link', { params });
};

// 查看是否授权的接口
export const getAuthStatus = async () => {
    return await request.get('/scrm-api/console/tenant/corp/auth-status');
};

// 查看是否授权的接口(无loading)
export const getAuthStatusNoLoading = async () => {
    return await request.get('/scrm-api/console/tenant/corp/auth-status', {
        noNeedLoading: true
    });
};

// 获取代开发授权二维码地
export const getCustomizedtAppQrcode = async () => {
    return await request.get('/scrm-api/console/tenant/corp/get-customized-app-qrcode');
};
// 获取配置引导的连接地址
export const geturlList = async (data: any) => {
    return await request.get('scrm-api/console/tenant/corp/auth-info');
};
// 第三方应用保存
export const thirdConfig = async (params: any) => {
    return await request.get('/scrm-api/console/app/save-third-app-config', { params });
};
// 查看第三方配置信息
export const lookThird = async (params: any) => {
    return await request.get('/scrm-api/console/app/get-third-app-config', { params });
};
// 第三方应用添加
export const addThird = async (params: any) => {
    return await request.get('/scrm-api/console/app/third-app-add', { params });
};
